/**
 * @FileName ConcreteCommand.java
 * @Package com.designMode.command
 * -------------------------------------
 * @function Please write description of function
 * @Date 2016-1-6 上午11:50:53
 * -------------------------------------
 * Copyright (c) 2016,顾博君 All Rights Reserved.
 */
package com.designMode.command;

/**
 * @author 顾博君
 * @ClassName ConcreteCommand
 * @Date 2016-1-6 上午11:50:53
 * @Function 具体命令类
 */
public class ConcreteCommand extends Command {
    private String name = "";
    // 对哪个receiver进行命令处理
    private Receiver receiver;

    /**
     * 命令构造函数，关联命令接收者
     *
     * @param _receiver 命令接收者
     */
    public ConcreteCommand(Receiver _receiver, String _name) {
        receiver = _receiver;
        name = _name;
    }

    /**
     * 命令执行函数
     */
    @Override
    public void execute() {
        // 执行命令动作
        System.out.println("命令" + name + ":开始执行");
        // 接收者处理命令
        receiver.doSomething();
    }
}
